package com.swanclouds.redfish.managers.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.ModelEntity;
import com.swanclouds.model.managers.VirtualMedia;
import java.util.List;
import java.util.Map;

public class VirtualMediaModel implements VirtualMedia {
    //虚拟媒介集合资源的访问路径
    @JsonProperty("@odata.id")
    private String dataId;

    //虚拟媒介集合资源模型的OData描述信息
    @JsonProperty("@odata.context")
    private String context;

    //虚拟媒介集合资源的类型
    @JsonProperty("@odata.type")
    private String type;

    //虚ID拟媒介集合资源的
    @JsonProperty("Id")
    private String id;

    //虚拟媒介集合资源的名称
    @JsonProperty("Name")
    private String name;

    //可以对虚拟媒体执行的操作
    @JsonProperty("Actions")
    private Map<String,Object> actions;

    //自定义属性信息
    @JsonProperty("Oem")
    private Map<String,Object> oem;

    /**
     * 媒体镜像类型，包括
     * CD
     * Floppy
     * USBStick
     * DVD
     */
    @JsonProperty("MediaTypes")
    private List<String> mediaTypes;

    //是否写保护
    @JsonProperty("WriteProtected")
    private Boolean writeProtected;

    //镜像名称
    @JsonProperty("ImageName")
    private String imageName;

    //用户名
    @JsonProperty("UserName")
    private String userName;

    //查询时显示null
    @JsonProperty("Password")
    private String password;

    /**
     * 是否插入
     *  true(插入)
     *  false(不插入)
     */
    @JsonProperty("Inserted")
    private Boolean inserted;

    /**
     * 连接方式
     *  NotConnected
     *  URI
     *  Applet
     *  Oem
     */
    @JsonProperty("ConnectedVia")
    private String connectedVia;

    //镜像URI
    @JsonProperty("Image")
    private String image;

    @JsonProperty("TransferProtocolType")
    private String transferProtocolType;

    @JsonProperty("Description")
    private String description;

    @JsonProperty("TransferMethod")
    private String transferMethod;

    //任务运行状态
    @JsonProperty("TaskState")
    private String taskState;

    //任务开始时间
    @JsonProperty("StartTime")
    private String startTime;

    //提示信息
    @JsonProperty("Message")
    private List<String> messages;

    @Override
    public String getDataId() {
        return this.dataId;
    }

    @Override
    public String getContext() {
        return this.context;
    }

    @Override
    public String getType() {
        return this.type;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public Map<String, Object> getActions() {
        return actions;
    }

    @Override
    public Map<String, Object> getOem() {
        return oem;
    }

    public List<String> getMediaTypes() {
        return mediaTypes;
    }

    public Boolean getWriteProtected() {
        return writeProtected;
    }

    public String getImageName() {
        return imageName;
    }

    public String getUserName() {
        return userName;
    }

    public String getPassword() {
        return password;
    }

    public Boolean getInserted() {
        return inserted;
    }

    public String getConnectedVia() {
        return connectedVia;
    }

    public String getImage() {
        return image;
    }

    public String getTransferProtocolType() {
        return transferProtocolType;
    }

    public String getDescription() {
        return description;
    }

    public String getTransferMethod() {
        return transferMethod;
    }

    public enum VmmControlType implements ModelEntity {

        Disconnect("Disconnect","断开虚拟媒体"),
        Connect("Connect","连接虚拟媒体");

        private String value;
        private String description;

        VmmControlType(String value,String description) {
            this.value = value;
             this.description = description;
        }
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "VirtualMediaModel{" +
                "dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", actions=" + actions +
                ", oem=" + oem +
                ", mediaTypes=" + mediaTypes +
                ", writeProtected=" + writeProtected +
                ", imageName='" + imageName + '\'' +
                ", userName='" + userName + '\'' +
                ", password='" + password + '\'' +
                ", inserted=" + inserted +
                ", connectedVia='" + connectedVia + '\'' +
                ", image='" + image + '\'' +
                ", transferProtocolType='" + transferProtocolType + '\'' +
                ", description='" + description + '\'' +
                ", transferMethod='" + transferMethod + '\'' +
                ", taskState='" + taskState + '\'' +
                ", startTime='" + startTime + '\'' +
                ", Message=" + messages +
                '}';
    }
}
